<template>
	<view>
		<cu-custom bgColor="theme-bg-color" :isBack="true">
			<block slot="content">缺 勤 记 录 </block>
		</cu-custom>

		<view class='bg-white margin-xs'>
			<view class='dashed-bottom padding-bottom-lg padding-top-xs' v-if="RepList.length>0"
				v-for="(item,index) in RepList">
				<view class="flex ">

					<view class="padding-left-xs">
						<view class="text-md text-bold margin-bottom-xs ">缺勤时间:{{item.date}}
						</view>
						<view class='margin-bottom-xs' v-if='item.count==0'><text
								class='margin-left-xs cu-tag bg-grey round'>上课</text>
							<text class='margin-left-xs cu-tag bg-grey round'>下课</text>
						</view>
						<view class='margin-bottom-xs' v-if='item.count==1'>
							<text class='margin-left-xs cu-tag bg-grey round'>下课</text>
						</view>
						<view v-for="(reCheck) in item.reChecks" class="margin-bottom-xs">
							<view><text
									class="text-xs margin-left-xs margin-bottom-xs">补卡时间{{reCheck.BeginTime}}~{{reCheck.EndTime}}
								</text>
								<text class="cu-tag margin-left-xs round"
									v-if="reCheck.AuditStatus==0">{{reCheck.AuditStatusFormat}}</text>
								<text class="cu-tag margin-left-xs round bg-green sm"
									v-if="reCheck.AuditStatus==1">{{reCheck.AuditStatusFormat}}</text>

								<text class="cu-tag margin-left-xs round  bg-red sm"
									v-if="reCheck.AuditStatus==2">{{reCheck.AuditStatusFormat}}</text>

							</view>
							<view><text class="text-xs margin-left-xs margin-bottom-xs">申请内容:{{reCheck.Reply}}</text>
							</view>
							<view><text class="text-xs margin-left-xs margin-bottom-xs">拒绝原因:{{reCheck.Reply}}</text>
							</view>


						</view>

					</view>
					<view></view>
				</view>
				<view class='margin-top-xs flex  justify-end '>
					<view class='cu-btn round bg-cyan sm' v-if='item.reSuccessChecks==0' @click="Rep(item)">我要补卡</view>
				</view>

			</view>
			<view v-else>
				<cu-no-data></cu-no-data>
			</view>
		</view>


	</view>
</template>

<script>
	import store from "@/store";
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				keyword: "",
				Where: {},
				RepList: []
			}
		},
		computed: {
			...mapGetters([
				'token', 'RoleTypeFormat', "userInfo", "userId"
			])
		},
		onLoad(option) {
			if (!this.userInfo.OrganizationId) {
				this.$comm.ShowToast("你还未加入班级");
				uni.navigateBack()
				return;

			}

		},
		onShow() {
			this.RepListApi();
		},
		methods: {
			/**
			 * 我的记录
			 */
			async RepListApi() {
				let {
					Data
				} = await this.$http.PostAsync("/CheckRecord/GetNeedRepList", {
					UserId: this.userInfo.Id,

				});
				this.RepList = Data;
			},
			async Rep(item) {
				let confirm = await this.$comm.ShowModal("你确定要补卡申请吗?");

				if (confirm == false) {
					await this.$comm.ShowToast("用户放弃操作");
					return;
				}
				uni.navigateTo({
					url: "/pages/Check/RepApply?Date=" + item.date
				})

			},


		}
	}
</script>

<style>

</style>